package com.vichat.api.vo;


import com.vichat.api.util.NumberUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by wangluyin on 2017/12/21.
 */
public class Room {
    public Long rid;

    public Long partyId;

    public String name;

    /**
     * 频道类型
     * 1 语音对讲
     * 3 频道对讲
     */
    public Long style = 3L;

    /**
     * 对讲控制
     * 0 自由对讲
     * 1 排队对讲，不可抢夺
     * 2 优先级对讲，高级可抢夺
     * 3 优先级对讲，同级可抢夺
     */
    public Long pttCtrl = 2L;

    public Long getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(Long ownerId) {
        this.ownerId = ownerId;
    }

    public Long getShareVideoUid() {
        return shareVideoUid;
    }

    public void setShareVideoUid(Long shareVideoUid) {
        this.shareVideoUid = shareVideoUid;
    }

    public Long shareVideoUid = 0L;

    public Long ownerId = 0L;

    public Long getExpireType() {
        return expireType;
    }

    public void setExpireType(Long expireType) {
        this.expireType = expireType;
    }

    public Long getHour() {
        return hour;
    }

    public void setHour(Long hour) {
        this.hour = hour;
    }

    public java.lang.Long expireType;
    public java.lang.Long hour = 0l;
    public Long getStyle() {
        return style;
    }

    public void setStyle(Long style) {
        this.style = style;
    }

    public Long getPttCtrl() {
        return pttCtrl;
    }

    public void setPttCtrl(Long pttCtrl) {
        this.pttCtrl = pttCtrl;
    }

    public Long getPartyId() {
        return partyId;
    }

    public void setPartyId(Long partyId) {
        this.partyId = partyId;
    }

    public Long getRid() {
        return rid;
    }

    public void setRid(Long rid) {
        this.rid = rid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }
    public void setErrorResultCode() {
        this.resultCode = "0099";
    }
    public String getResultMsg() {
        return resultMsg;
    }

    public void setResultMsg(String resultMsg) {
        this.resultMsg = resultMsg;
    }

    public String resultCode ="0000";
    public String resultMsg;


    public void check() throws Exception{
        if (NumberUtils.isNullOrZero(this.getPartyId())) {
            throw new Exception("缺少参数partyId");
        }
        if (NumberUtils.isNullOrZero(this.getRid())) {
            throw new Exception("缺少参数roomId");
        }
    }

    private long[] uids;

    public long[] getUids() {
        return uids;
    }

    public void setUids(long[] uids) {
        this.uids = uids;
    }

    public void createRoomCheck() throws Exception{
        if (this.getUids() == null || this.getUids().length == 0) {
            throw new Exception("缺少参数uids");
        }
        if (NumberUtils.isNullOrZero(this.getPartyId())) {
            throw new Exception("缺少参数partyId");
        }
        if (StringUtils.isEmpty(this.getName())) {
            throw new Exception("频道名称不能为空");
        }
    }
}
